package red.action;

import com.opensymphony.xwork2.Action;
import red.model.ArticleModel;
import red.service.ArticleService;
import red.service.impl.ArticleServiceImpl;
import red.util.BaseAction;
import red.util.Model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class ArticleActionZ extends BaseAction {

    private Map<String,Object> result;

    private ArticleService articleService = new ArticleServiceImpl();

    private ArticleModel articleModel;

    private List<ArticleModel> articleModels;

    public ArticleModel getArticleModel() {
        return articleModel;
    }

    public void setArticleModel(ArticleModel articleModel) {
        this.articleModel = articleModel;
    }

    public List<ArticleModel> getArticleModels() {
        return articleModels;
    }

    public void setArticleModels(List<ArticleModel> articleModels) {
        this.articleModels = articleModels;
    }


    public String deletearticle(){
        Model model = getParams();
        articleModel = articleService.deletearticle(model);
        return Action.SUCCESS;
    }

    public String selectarticle(){
        Model model = getParams();
        articleModels = articleService.selectarticle(model);
        return Action.SUCCESS;
    }

    public String selectq(){
        Model model = getParams();
        articleModels = articleService.selectq(model);
        return Action.SUCCESS;
    }

    public String getArticle(){
        articleModels=new ArrayList<>();
        return Action.SUCCESS;
    }

}
